// Copyright (C) 2011  Andrew H. Chan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

#ifndef _UTIL_H__
#define _UTIL_H__
#include "typedefs.h"

std::ostream& operator<<(std::ostream& os, bmatrix const& bmat);

std::ostream& operator<<(std::ostream& os, bvector const& bv);

//std::ostream& operator<<(std::ostream& os, segmented_data const& seg_data);

template<typename T, typename S>
std::ostream& operator<<(std::ostream& os, std::pair<T, S> const& pr) {
    os << '(' << pr.first << ", " << pr.second << ')';
    return os;
}

template<typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> const& vec) {
    for(uint ii=0; ii<vec.size(); ++ii) {
        os << vec[ii] << ' ';
    }
    return os;
}

template<>
std::ostream& operator<< <char>(std::ostream& os, std::vector<char> const& vec);

bvector append_bvectors(bvector const& a, bvector const& b);
template<typename T>
std::vector<T> append_vectors(std::vector<T> const& a, std::vector<T> const& b) {
    std::vector<T> tmp;
    tmp = a;
    tmp.insert(tmp.end(), b.begin(), b.end());
    return tmp;
}

#endif
